package com.ericcson.innerportalapp;

import java.util.ArrayList;

import com.google.gson.Gson;

import android.os.Bundle;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;

public class PersonDetail extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_person_deatil);
		Intent detailIntent = getIntent();
		Gson gson = new Gson();
		String obj = detailIntent.getStringExtra("obj");
		PeopleListItem people = gson.fromJson(obj, PeopleListItem.class);

		ListView lw = (ListView) findViewById(R.id.perdetLw);
		
		PeopleListItem[] list = new PeopleListItem[6];
			for(int i=0; i<6; i++){
				list[i] = people;
			}
		
		ActionBar ab = getActionBar();
        ab.setDisplayHomeAsUpEnabled(true);
        ab.setTitle(people.getName());
        ab.setIcon(R.drawable.ic_action_person);
      
        PeopleDetailArrayAdapter adp = new PeopleDetailArrayAdapter(this, R.layout.person_detail_item, list);
		lw.setAdapter(adp);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.person_deatil, menu);
		return true;
	}

}
